package middlewares

import (
	"crypto/hmac"
	"crypto/md5"
	"encoding/hex"
)

func Hmac(key, data string) string {
	// 创建对应的md5哈希加密算法
	hash := hmac.New(md5.New, []byte(key))

	hash.Write([]byte(data))

	return hex.EncodeToString(hash.Sum([]byte("")))

}
